package com.authorization.authorizationserveronsso.bo;

import com.authorization.authorizationserveronsso.entity.Users;
import org.springframework.security.core.userdetails.User;

import java.util.Collections;

/**
 * <p>Description: </p>
 * @date
 * @author
 * @version 1.0
 * <p>Copyright:Copyright(c)2020</p>
 */
public class OAuthTradeUser extends User {

    private static final long serialVersionUUID = -1L;

    /**
     * 业务用户信息
     */
    private Users tradeUser;

    public OAuthTradeUser(Users tradeUser) {
        // OAUTH2认证用户信息构造处理
        super(tradeUser.getUsername(), tradeUser.getPassword(), (tradeUser.getEnabled().equals("1") ? true : false),
                true, true, (tradeUser.getEnabled().equals("1") ? true : false), Collections.emptyList());
        this.tradeUser = tradeUser;
    }

    public Users getTradeUser() {
        return tradeUser;
    }
}
